package com.bird.extension.assignable;

/**
 * @Author: sijunqiang
 * @Date: 2020/4/19 9:50
 * @Description: 该类的专门测试: 一个类是否是父类的子类或者是接口的实现类
 */
public class AssignableDemo {


    /**
     * 该方法是：测试assignable的使用
     */
    public static void main(String[] args) {

        System.out.println("**************************类的测试********************************************");
        System.out.println("1.判断: FirstClass是FirstClass这个类了父类或者本身：" + FirstClass.class.isAssignableFrom(FirstClass.class));
        System.out.println("2.判断：FirstClass是否是SecondClass这个类的超类: " + FirstClass.class.isAssignableFrom(SecondClass.class));
        System.out.println("3.判断：SecondClass是否是FirstClass这个类的超类：" + SecondClass.class.isAssignableFrom(FirstClass.class));
        System.out.println("4.判断：FirstClass是否是ThirdClass这个类的超类或者父类：" + FirstClass.class.isAssignableFrom(ThirdClass.class));
        System.out.println("5:判断：FirstClass是否是UnrelevantClass这个类的父类或者超类：" + FirstClass.class.isAssignableFrom(UnrelevantClass.class));


        System.out.println("*****************************接口的测试*******************************************");
        System.out.println("6.FirstInterFace.class.isAssignableFrom(FirstInterFace.class)：" + FirstInterface.class.isAssignableFrom(FirstInterface.class));
        System.out.println("7.FirstInterFace.class.isAssignableFrom(SecondInterface.class)：" + FirstInterface.class.isAssignableFrom(SecondInterface.class));
        System.out.println("8.SecondInterface.class.isAssignableFrom(FirstInterface.class)：" + SecondInterface.class.isAssignableFrom(FirstInterface.class));
        System.out.println("9.FirstInterFace.class.isAssignableFrom(ThirdInterface.class)：" + FirstInterface.class.isAssignableFrom(ThirdInterface.class));
        System.out.println("10.FirstInterFace.class.isAssignableFrom(UnrelevantInterface.class)：" + FirstInterface.class.isAssignableFrom(UnrelevantInterface.class));

















    }

}
